new Vue({
	el: '#app',
	data: {
		sdate: '',
		edate: '',
		sname: '',
		sprojcet: '',
		list: [],
		info: {
			id:'',
			projectName:'',
			status:'',
			subjectContent:'',
			targets:[],
		},
		headers:[
				{title:'体检患者',key:'realName'},
				{title:'体检项目',key:'projectName'},
				{title:'体检时间',key:'createTime'},
				{title:'订单状态',key:'status'},
				],
		open: false,
		totalNum:'',
		openNum:1,
	},
	created() {

		showHead();
		showLeftMenu();
		// 在页面创建时发送Ajax请求
		var params = new URLSearchParams(window.location.search);
		
		this.scardid = params.get('card_id'); 
		
		this.getReportList(0)
		
		
	},
	methods: {
		getReportList(page){
			
			var _this = this;
			if(this.sdate != '' && this.edate !=''){
				this.sdate = (new Date(sdate)).getTime()/1000;
				this.edate = (new Date(edate)).getTime()/1000;
				if(this.sdate == this.edate){
					alert("起始和结束时间不能为同一天");
					return;
				}else if(this.edate < this.sdate){
					alert("结束时间不能小于起始时间");
					return;
				}
			}
			
			
				$.ajax("/doctor/Report/getReportList", {
					type: "POST",
					data: {
						sdate:_this.sdate,
						edate:_this.edate,
						sname:_this.sname,
						sprojcet:_this.sprojcet,
						page:page,
					},
					success: function(data, textStatus) {
						let datas = JSON.parse(data);
						if (datas.statusCode == 200) {
							
							_this.list = datas.datas.order;
							_this.totalNum = datas.datas.count;
						} else {
							reject(datas.errMsg);
						}
					}
				})
		},
		gerReportInfo(id){
			
				var _this = this;
				$.ajax("/doctor/Report/getReportInfo", {
					type: "POST",
					data: {
						id:id,
					},
					success: function(data, textStatus) {
						let datas = JSON.parse(data);
						if (datas.statusCode == 200) {
							console.log(datas.datas.info);
							_this.info.projectName=datas.datas.info.projectName;
							_this.info.id = datas.datas.info.id;
							_this.info.status = datas.datas.info.status;
							_this.info.targets = datas.datas.info.targets;
							_this.info.subjectContent = datas.datas.info.subjectContent;
						} else {
							datas.errMsg;
						}
					}
				})
		},

		showFrom: function(id) {
			this.gerReportInfo(id)
			this.open = true;
			console.log(this.open);
			console.log(this.info)
		},
		closeFrom: function() {
			this.open = false;
		},
		updateList(openNum){	
			this.openNum = openNum
			this.getMealList(openNum)	
		},
		updateOpen(open){
				this.open = open
		}
		
	},
	computed: {

	},

})